package LeetCode;

import java.util.Scanner;

public class No283 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String[] chs = s.split(",");

        int[] a = new int[chs.length];
        for (int i = 0; i < chs.length; i++) {
            a[i] = Integer.parseInt(chs[i]);
        }
        moveZeroes(a);
    }

    public static void moveZeroes(int[] nums) {
        int right=0,left=0,length = nums.length;
        while(right<length){
            if(nums[right]!=0){//右指针所指数非零时，将该指针所指位置赋值成0，再对左指针指的值进行赋值
                int temp = nums[right];
                nums[right]=0;
                nums[left] = temp;
                left++;
            }
            right++;
        }

        //枚举加冒泡
//        int length = nums.length;
//        for (int i = 0; i < length; i++) {
//            if(nums[i]==0){
//                for (int j = i; j < length-1; j++) {
//                    nums[j] = nums[j+1];
//                    nums[j+1]=0;
//                }
//                length--;
//                i--;
//            }
//        }

    }
}
